class CreateProducts < ActiveRecord::Migration
  def change
    create_table :products, :force => true do |t|
      t.string  :presentation,     :limit => 70, :null => false
      t.string  :url,      :limit => 70, :null => false
      t.text    :description_html,              :null => true
      t.text    :description_detail_html,       :null => true
      t.references :tax_category, :limit => 2, :null => false
      t.references :amount_type,         :null => false
      t.integer :minimum_quantity, :default => 1, :limit => 6
      t.string  :title,    :limit => 250,:null => false
      t.string  :state, :limit => 15, :default => "on_sale"
      t.datetime :deleted_at,            :null => true
      t.date    :on_sale_from,           :null => true
      t.date    :on_sale_to,             :null => true
      t.timestamps
    end

    add_index :products, :url, :unique => true
  end
end